<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增课题项目')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-item-add">
        	<input name="topicId" type="hidden" th:value="${topicId}">
        	<input id="itemTypeId" name="itemTypeId" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">项目排序：</label>
                <div class="col-sm-8">
                    <input name="itemSort" class="form-control" type="number" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">项目类型：</label>
                <div class="col-sm-8">
                    <select id="itemType" name="itemType" class="form-control m-b">
                        <option value="W">问卷</option>
                        <option value="W">表单</option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">项目名称：</label>
                <div class="col-sm-8">
                    <input id="itemTypeName" name="itemTypeName" class="form-control" onclick="selectItemName()" type="text" readonly required>
                </div>
            </div>
            <!--  
            <div class="form-group">    
                <label class="col-sm-3 control-label">触发事件条件[无事件/必定触发/大于/小于/等于]：</label>
                <div class="col-sm-8">
                    <input name="eventCondition" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">触发事件值：</label>
                <div class="col-sm-8">
                    <input name="eventValue" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">触发事件类型：</label>
                <div class="col-sm-8">
                    <select name="eventType" class="form-control m-b">
                        <option value="">所有</option>
                    </select>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
                </div>
            </div>
            -->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "kt/topic"
        $("#form-item-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/item/add", $('#form-item-add').serialize());
            }
        }
        
        function selectItemName(){
        	var url = prefix + "/selectItem/"+$("#itemType").val();
			$.modal.open("选择项目", url);
        }
    </script>
</body>
</html>